/*
	system 函数等价于 exec+fork 函数功能
	  且system为原子操作。
   The return value of system() is one of  the  fol‐
   lowing:

   *  If  command is NULL, then a nonzero value if a
      shell is available, or 0 if no shell is avail‐
      able.

   *  If  a  child  process could not be created, or
      its status could not be retrieved, the  return
      value is -1.

   *  If  a shell could not be executed in the child
      process, then the return value  is  as  though
      the child shell terminated by calling _exit(2)
      with the status 127.

   *  If all system calls succeed, then  the  return
      value  is  the termination status of the child
      shell used to execute command.  (The  termina‐
      tion status of a shell is the termination sta‐
      tus of the last command it executes.)

   In the last two cases,  the  return  value  is  a
   "wait  status"  that  can  be  examined using the
   macros described in  waitpid(2).   (i.e.,  WIFEX‐
   ITED(), WEXITSTATUS(), and so on).

   system()  does  not affect the wait status of any
   other children.
*/

#if 0	//功能测试
#include <stdio.h>
#include <stdlib.h>



void lap_system(void)
{
	//shell 命令
	 system("ls");
}

int main(void)
{
	lap_system();
	return 0;
}
#endif







																						 
